<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<meta name="_csrf" th:content="${_csrf.token}" />
<meta name="_csrf_header" th:content="${_csrf.headerName}" />
<link th:href="@{/static/bootstrap/css/bootstrap.min.css}"
	rel="stylesheet">
<link rel="stylesheet" th:href="@{/static/css/sb-admin-2.css}">
<link th:href="@{/static/codemirror/lib/codemirror.css}"
	rel="stylesheet">
<link th:href="@{/static/codemirror/addon/hint/show-hint.css}"
	rel="stylesheet">
<link th:href="@{/static/css/blog.css}" rel="stylesheet">
<!--[if lt IE 9]>
	  <script th:src="@{/static/js/html5shiv.min.js}"></script>
	  <script th:src="@{/static/js/respond.min.js}"></script>
	<![endif]-->
<style type="text/css">
.table-borderless tbody tr td, .table-borderless tbody tr th,
	.table-borderless thead tr th {
	border: none;
}

.cm-tab {
	background: none !important;
}
</style>
<title>自定义挂件管理</title>
</head>
<body>
	<nav th:replace="mgr/base/nav :: active('tpl-fragment')"></nav>
	<div id="page-wrapper" style="padding: 10px">
		<div class="container-fluid">
			<div class="row">
				<div class="col-md-12">
					<div class="table-responsive">
						<table class="table">
							<thead>
								<tr>
									<th>数据名</th>
									<th>外部调用</th>
								</tr>
							</thead>
							<tbody>
								<tr th:each="data,iter : ${datas}">
									<td>[[${data.name}]]</td>
									<td><input type="radio"
										th:attr="checked=${data.callable ? 'checked' : null}" th:data-name="${data.name}" onclick="updateCallable($(this))" th:name="${iter.index}+'callable'" value="true"/>是
										&nbsp;&nbsp;&nbsp;&nbsp; <input type="radio"
										th:attr="checked=${data.callable ? null : 'checked'}" th:data-name="${data.name}" onclick="updateCallable($(this))" th:name="${iter.index}+'callable'" value="false"/>否</td>
								</tr>
							</tbody>
						</table>
					</div>
				</div>
			</div>
		</div>
	</div>
	<div th:replace="base/foot_source"></div>
	<script type="text/javascript" th:src="@{/static/js/mgr/common.js}"></script>
	<script>
		function updateCallable(o){
			var callable = o.val();
			var name = o.data('name');
			$.post(rootPath+'/mgr/template/data/updateCallable',{name:name,callable:callable},function(data){
				bootbox.alert(data.message);
			});
		}
	</script>
</body>
</html>